#include "StdAfx.h"
#include "HackerTest.h"
#include <cppunit/config/SourcePrefix.h>

CPPUNIT_TEST_SUITE_REGISTRATION( CHackerTest );

CHackerTest::CHackerTest( void )
{
}


CHackerTest::~CHackerTest( void )
{
}

void CHackerTest::Test()
{
    TCHAR* pModuleName = _T( "g:\\project\\codelib\\bin\\uitest.exe" );
    TCHAR* pDllName = _T( "USER32.dll" );
    TCHAR* pFuncName = _T( "MessageBoxW" );
    typedef int ( *FuncMsgBox )( __in_opt HWND hWnd,
                                 __in_opt LPCSTR lpText,
                                 __in_opt LPCSTR lpCaption,
                                 __in UINT uType );
    FuncMsgBox pNewFuncName = ( FuncMsgBox )( &CHackerTest::MyMessageBoxW );
    BOOL bRet = m_hacker.HookIATFunc( pModuleName, pDllName, pFuncName, pNewFuncName );
    CPPUNIT_ASSERT( bRet );
}

void CHackerTest::setUp()
{

}

void CHackerTest::tearDown()
{

}

int CHackerTest::MyMessageBoxW(
    __in_opt HWND hWnd,
    __in_opt LPCSTR lpText,
    __in_opt LPCSTR lpCaption,
    __in UINT uType )
{
    //todo yourself
    return MessageBoxW( NULL, _T( "hello world" ), _T( "caption" ), MB_OK );
}
